package com.xxh.common.utils;


import lombok.Data;

import java.util.HashMap;

@Data
/**
 * 统一返回结果集
 */
public class Result extends HashMap<String, Object> {

    public Result() {
        this.put("code", 200);
    }

    public static Result error() {
        Result r = new Result();
        r.put("code", 500);
        r.put("msg", "error");
        return r;
    }

    public static Result success() {
        Result r = new Result();
        r.put("code", 200);
        r.put("msg","请求完成");
        return r;
    }

    @Override
    public Result put(String key, Object value) {
        super.put(key, value);
        return this;
    }

}
